﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq.Mapping;
using System.Text;
using lib.Twitter;
using System.Text.RegularExpressions;

namespace lib.Twitter
{
    [Table(Name = "User")]
    public class User
    {
        [Column]
        public DateTime created_at;
        [Column]
        public String description;
        [Column]
        public int favourites_count;
        [Column]
        public int followers_count;
        [Column]
        public int friends_count;
        [Column(IsPrimaryKey = true)]
        public long id;
        [Column]
        public String location;
        private string n;
        [Column]
        public String name{
            get{return n;}
            set{n=Regex.Unescape(value);}
        }
        private string u;
        [Column]
        public String profile_image_url{
            get { return u; }
            set { u = Regex.Unescape(value); }
        }
        [Column]
        public String screen_name;
        [Column]
        public int statuses_count;
        [Column]
        public String url;

        public User() { }

        // copy constructor

        public User(User newUser)
        {
            this.created_at = newUser.created_at;
            this.description = newUser.description;
            this.favourites_count = newUser.favourites_count;
            this.followers_count = newUser.followers_count;
            this.friends_count = newUser.friends_count;
            this.id = newUser.id;
            this.location = newUser.location;
            this.name = newUser.name;
            this.profile_image_url = newUser.profile_image_url;
            this.screen_name = newUser.screen_name;
            this.statuses_count = newUser.statuses_count;
            this.url = newUser.url;
        }

        public override string ToString()
        {
            return this.screen_name + " " + this.name;
        }
    }
}
